//
//  JQFYTicketInfoTableViewCell.m
//  JQFY
//
//  Created by apple on 2017/9/2.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYTicketInfoTableViewCell.h"


@implementation JQFYTicketInfoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    self.backgroundColor = [UIColor clearColor];
    UIView *containView = [[UIView alloc] init];
    containView.backgroundColor = RGBCOLOR(46, 21, 97);
    containView.layer.cornerRadius = 5;
    containView.layer.edgeAntialiasingMask = YES;
    [self.contentView addSubview:containView];
    [containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.top.bottom.equalTo(self.contentView);
    }];
    
    CGFloat width = (DH_Screen_Width - 10 * 2 - 10 * 5) / 9.f;
    
    for (int i = 0; i<8; i++) {
        UIImageView *iconImg = [[UIImageView alloc]init];
        iconImg.backgroundColor = [UIColor whiteColor];
        iconImg.layer.cornerRadius = width / 2.f;
        iconImg.layer.masksToBounds = YES;
        [containView addSubview:iconImg];
        CGFloat offsetX = i * (width + 5) + 5;
        
        [iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(containView).offset(offsetX);
            make.centerY.mas_equalTo(containView);
            make.size.mas_equalTo(width);
        }];
    }
    UIImageView  *findMore = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ticketInfo_findMore"]];
    findMore.contentMode = UIViewContentModeCenter;
    [self.contentView addSubview:findMore];
    
    [findMore mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(containView).offset(8 * (width + 5) + 5);
        make.centerY.mas_equalTo(containView);
        make.size.mas_equalTo(width);
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (CGFloat)heightForCell {
    return (DH_Screen_Width - 10 * 2 - 10 * 5) / 9.f + 10;
}

@end
